import cgi
import os
import xml.etree.cElementTree as etree

from google.appengine.ext.webapp import template
from google.appengine.ext import webapp
from google.appengine.api import memcache
from google.appengine.api import urlfetch
from google.appengine.ext.webapp.util import run_wsgi_app

from db_model import User
from db_model import Envy
from db_model import Product
from db_model import Review

# Third party imports
import appjson
import oauth    
from Crypto.PublicKey import RSA
from Crypto.Util import number

class UserServer(webapp.RequestHandler):
  def get(self):
    userid = self.request.get("userid")
    name = self.request.get("name")
    orkutid = self.request.get("orkutid")
    users = User.gql('WHERE orkutId=:orkutid', orkutid=orkutid).fetch(1)
    user = None
    if(len(users) > 0):
      user = users[0]
    else:
      user = User(orkutId=orkutid)

    user.id =  userid
    user.name = name
    user.put()
    self.response.out.write('good')
    
